<?php //  Yii::app()->clientScript->scriptMap['jquery.js'] = false;     ?>

<?php Util::tsRegisterAssetJs('_pedidosPendientesModal.js') ?>


<?php // var_dump($pedidosPendientes) ?>

<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="h3Modal">Pedidos Pendientes</h3>
</div>

<div class="modal-body contenedorPedidos">
    <div class="container-fluid">
        <div class="row-fluid">





            <?php foreach ($pedidosPendientes as $value) : ?>
                       
            <?php if($value->validarMenusVisibles()) : ?>

                <div id="<?php echo $value->id ?>" class="widget bluesky span6 pedidoCocinaModal" >
                    <div class="widget-title">
                        <h4><i class="icon-white icon-shopping-cart"></i> PEDIDO</h4><span  class="badge"> <?php echo $value->ticket->numero ?> </span>
                    </div>

                    <div class="widget-body pedidoBody" >


                        <table  class="items table table-striped table-bordered table-hover table-advance table-condensed">
                            <thead>
                                <tr>

                                    <th id="orden-pedido-grid_c0">Cant.</th>
                                    <th id="orden-pedido-grid_c1">Menu</th>
                                    <th id="orden-pedido-grid_c2" >Estado</th>

                                    <th class="button-column" id="orden-pedido-grid_c3">X</th>
                                </tr>
                            </thead>
                            <tbody >
                                  

                                <?php // var_dump($value->pedidoMenus); die();?>
                                <?php foreach ($value->pedidoMenus as $menu) : ?>
                                    <?php if ($menu->estado != 'TERMINADO' && $menu->estado != 'ANULADO' && $menu->menu->seccion->cocina ==1): ?>
                                        <tr id="<?php echo $menu->id; ?>"> 
                                            <td><?php echo $menu->cantidad; ?></td>
                                            <td><?php echo $menu->menu->nombre; ?></td>
                                            <td ><btn id="estado<?php echo $menu->id; ?>"  class="btn <?php echo $menu->estado; ?>" ><?php echo $menu->estado; ?>  </btn></td>
                                    <td><a class="delete" title="" rel="tooltip" href="#" data-original-title="Borrar" onclick="cancelarMenuDePedido(<?php echo $menu->id; ?>);"><i class="icon-trash"></i></a></i></td>
                                                                     <!--<td ><btn id="estado< ?php echo $menu->id; ?>"  class="btn < ?php echo $menu->estado; ?>" onclick="cambiarEstadoMneu(< ?php echo $menu->id; ?>)">< ?php echo $menu->estado; ?>  </btn></td>-->

                                    </tr>
                                <?php endif; ?>
                            <?php endforeach; ?>
                            </tbody>
                        </table>

                    </div>
                    <div class="pedidoFooter">
                        <?php
                        $this->widget('bootstrap.widgets.TbButton', array(
//                    'buttonType'=>'success',
//                    'type' => 'default',
//                    'class'=>'terminarPedido',
                            'label' => 'Terminar',
                            'htmlOptions' => array('onclick' => "javascript:finalizarPedido($value->id)", 'class' => 'terminarPedido',
                            )
                        ));
                        ?>
                        <?php
                        $this->widget('bootstrap.widgets.TbButton', array(
//                    'buttonType'=>'danger',
                            'type' => 'danger',
//                    'class'=>'terminarPedido',
                            'label' => 'Cancelar Pedido',
                            'htmlOptions' => array('onclick' => "javascript:cancelarPedido($value->id)",
                                'class' => 'terminarPedido',
                            )
                        ));
                        ?>

                    </div>
                </div>
            <?php endif; ?>
            <?php endforeach; ?>

        </div>
    </div>
</div>

<div class="modal-footer">
    <?php
//    $this->widget('bootstrap.widgets.TbButton', array(
//                        'type' => 'success',
//                        'icon' => 'plus',
//                        'label' => 'Crear Producto',
//                        'encodeLabel' => false,
//                        'id' => 'edit-' . date('U'),
//                        'htmlOptions' => array(
//                            'onClick' => 'js:viewModal("productos/producto/create",function(){})',
//                        ),
//                    ));

    $this->widget('bootstrap.widgets.TbButton', array(
        'label' => 'Cerrar',
        'type' => 'inverse',
        'htmlOptions' => array('data-dismiss' => 'modal'),
            )
    );
    ?>
</div>